<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>仓库管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }

        var fid = "";

        function tfh(id) {
            fid = id;
            $('#myModal').modal();
        }

        function checkDeliver() {
            var remarks = $("#gs").val();
            if (remarks == '') {
                top.$.jBox.alert("请填写托盘个数");
                return;
            }
            var carriers = $("#rl").val();
            if (carriers == '') {
                top.$.jBox.alert("请填写托盘容量");
                return;
            }
            var lx = $("#lx").val();
            if (lx == '') {
                top.$.jBox.alert("请填写托盘类型");
                return;
            }
            $("#searchForm").attr("action", "${ctx}/stock/warehouse/tDeliver?id=" + fid+"&gs="+remarks+"&rl="+carriers+"&lx="+lx);

            $("#searchForm").submit();


        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/stock/warehouse/">仓库列表</a></li>
		<shiro:hasPermission name="stock:warehouse:edit"><li><a href="${ctx}/stock/warehouse/form">仓库添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="warehouse" action="${ctx}/stock/warehouse/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>编码：</label>
				<form:input path="code" htmlEscape="false" maxlength="10" class="input-medium"/>
			</li>
			<li><label>名称：</label>
				<form:input path="name" htmlEscape="false" maxlength="200" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>


	</form:form>

	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
						&times;
					</button>
					<h4 class="modal-title" id="myModalLabel">
						设置托盘
					</h4>
				</div>
				<div class="modal-body">
					<label class="span1 control-label">个数：</label>
					<div class="span2 ">
						<input type="text" id="gs" class="input-medium "/>

					</div>
				</div>
				<div class="modal-body">	<label class="span1 control-label">容量：</label>
					<div class="span2 ">
						<input type="text" id="rl" class="input-medium "/>

					</div>
				</div>
				<div class="modal-body">
					<label class="span1 control-label">托盘类型：</label>
					<div class="span2 ">
						<select name="lx" id="lx"  class="input-medium " >
							<c:forEach items="${fns:getDictList('warehouse_type')}" var="it">
								<option value="${it.value}">${it.label}</option>>
							</c:forEach>
						</select>

					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭
					</button>
					<button type="button" class="btn btn-primary" onclick="checkDeliver()">
						确认
					</button>
				</div>
			</div>
		</div>
	</div>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>编码</th>
				<th>名称</th>
				<shiro:hasPermission name="stock:warehouse:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="warehouse">
			<tr>
				<td><a href="${ctx}/stock/warehouse/form?id=${warehouse.id}">
					${warehouse.code}
				</a></td>
				<td>
					${warehouse.name}
				</td>
				<shiro:hasPermission name="stock:warehouse:edit"><td>
    				<a href="${ctx}/stock/warehouse/form?id=${warehouse.id}">修改</a>
				<%--	<a  style="cursor: pointer;" onclick="tfh('${warehouse.id}')"  >设置托盘</a>--%>
					<a href="${ctx}/stock/warehouse/delete?id=${warehouse.id}" onclick="return confirmx('确认要删除该仓库吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>


</body>
</html>